﻿<shared:WindowBase x:Class="Bymed.SpineScan.WPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:shared="clr-namespace:Bymed.SpineScan.WPF.Shared"
        xmlns:ignore="http://www.ignore.com"
        mc:Ignorable="d ignore"
        Icon="/Skins/Resource/Icon/Bymed.ico"
        WindowStartupLocation="CenterScreen"
        WindowStyle="SingleBorderWindow" 
        AllowsTransparency="False"
        WindowState="Normal"
        Height="820"
        Width="1280"
        Title="Spine Scan 脊柱健康管理系统" 
        DataContext="{Binding Main, Source={StaticResource Locator}}">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Window.Background>
        <ImageBrush ImageSource="/Skins/Resource/Image/MainWindowBackground.png"/>
    </Window.Background>
    <ScrollViewer VerticalScrollBarVisibility="Auto">
        <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <!-- Main Content -->
                <RowDefinition />
                <!-- Footer -->
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <!-- Cutomized System Buttons -->
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10">
                <Border Style="{StaticResource SystemButtonSeparatorBorder}" />
                <Menu Background="Transparent">
                    <MenuItem>
                        <MenuItem.Header>
                            <Image Stretch="Fill" Source="/Skins/Resource/Image/Help.png" Width="35" />
                        </MenuItem.Header>
                        <MenuItem Header="系统帮助" Command="{Binding HelpCommand}" />
                    </MenuItem>
                </Menu>
                <Border Style="{StaticResource SystemButtonSeparatorBorder}" />
                <Menu Background="Transparent">
                    <MenuItem>
                        <MenuItem.Header>
                            <Image Stretch="Fill" Source="/Skins/Resource/Image/Option.png" Width="35" />
                        </MenuItem.Header>
                        <MenuItem Header="主治医生配置" Command="{Binding AttendingDoctorSetupCommand}" />
                        <MenuItem Header="诊断信息配置" Command="{Binding DiagnosticMessageReferenceSetupCommand}" />
                        <MenuItem Header="自定义项目" Command="{Binding CustomizedTestItemCommand}" />
                        <MenuItem Header="数据管理" Command="{Binding DataManagementCommand}" />
                        <MenuItem Header="选项配置" Command="{Binding BasicConfigurationCommand}" />
                        <MenuItem Header="注册许可" Command="{Binding DeviceConfigurationCommand}" />
                    </MenuItem>
                </Menu>
                <Border Style="{StaticResource SystemButtonSeparatorBorder}" />
                <Button Tag="/Skins/Resource/Image/Home.png" Width="35" Style="{StaticResource OpacityImageButton}" Command="{Binding ReturnHomeCommand}"  />
                <Border Style="{StaticResource SystemButtonSeparatorBorder}" />
                <Button Tag="/Skins/Resource/Image/Minimize.png" Width="35" Style="{StaticResource OpacityImageButton}"  Click="BtnMinimize_Click" />
                <Border Style="{StaticResource SystemButtonSeparatorBorder}" />
                <Button Tag="/Skins/Resource/Image/Close.png"  Width="35" Style="{StaticResource OpacityImageButton}"  Click="BtnClose_Click" />
            </StackPanel>
            <Grid Margin="20">
                <Grid.RowDefinitions>
                    <!-- Title -->
                    <RowDefinition Height="Auto" />
                    <!-- Summary Message Display -->
                    <RowDefinition Height="Auto" />
                    <!-- Main Frame -->
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <!-- Title -->
                <Image Margin="0,20,0,0" HorizontalAlignment="Left" Source="/Skins/Resource/Image/SystemTitle.png" Width="530" />
                <!-- Summary Message Display -->
                <Grid Grid.Row="1" Margin="0,10,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Border CornerRadius="4" BorderThickness="0" Background="White" Padding="5" Visibility="{Binding ErrorMessageVisibility}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Skins/Resource/Image/Error.png" Height="24" Width="24" />
                            <TextBlock Text="{Binding ErrorMessage}" ToolTip="{Binding ErrorMessage}" TextWrapping="Wrap"
                                       FontWeight="Bold" FontSize="22" Foreground="Red" HorizontalAlignment="Center" Margin="3" />
                        </StackPanel>
                    </Border>
                    <Border CornerRadius="4" Grid.Row="1" BorderThickness="0" Background="White" Padding="5" Visibility="{Binding SummaryMessageVisibility}">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Skins/Resource/Image/Info.png" Height="24" Width="24" />
                            <TextBlock Text="{Binding SummaryMessage}" ToolTip="{Binding SummaryMessage}" TextWrapping="Wrap"
                                       FontWeight="Bold" FontSize="22" HorizontalAlignment="Center" Margin="3" />
                        </StackPanel>
                    </Border>
                </Grid>
                <!-- Main Frame -->
                <Frame x:Name="MainFrame" Grid.Row="2" Margin="0,-20,0,0" Content="{Binding CurrentMainFrameContent, Mode=OneWayToSource}"
                       NavigationUIVisibility="Hidden" Source="PatientBasicInfoPage.xaml">
                    <Frame.Style>
                        <Style TargetType="{x:Type Frame}">
                            <Setter Property="Visibility" Value="Visible" />
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding NeedToExcludeFromRestriction}" Value="False" />
                                        <Condition Binding="{Binding GenuineCheckPassed}" Value="False" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Frame.Style>
                </Frame>
                <!-- Main Frame Blocker. For Genuine Check ONLY. -->
                <Grid Grid.Row="2" Margin="0,40,0,0" Height="400" Background="#efefef">
                    <Grid.Style>
                        <Style TargetType="{x:Type Grid}">
                            <Setter Property="Visibility" Value="Collapsed" />
                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding NeedToExcludeFromRestriction}" Value="False" />
                                        <Condition Binding="{Binding GenuineCheckPassed}" Value="False" />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Visibility" Value="Visible" />
                                </MultiDataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Grid.Style>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Text="{Binding GenuineCheckResult}" FontSize="58" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    <TextBlock Grid.Row="1" Text="{Binding GenuineCheckDetail}" FontSize="36" HorizontalAlignment="Center" VerticalAlignment="Top" />
                </Grid>
            </Grid>
            <!-- Footer -->
            <Grid Grid.Row="1" TextBlock.FontSize="18" TextBlock.FontWeight="Light" Margin="0,0,0,10">
                <TextBlock Text="{Binding CurrentSystemDateTime}" Margin="20,0,0,0" HorizontalAlignment="Left" Foreground="White" />
                <TextBlock Text="© 2013 Bymed" Foreground="White" Margin="0,0,20,0" HorizontalAlignment="Right" />
            </Grid>
        </Grid>
    </ScrollViewer>
</shared:WindowBase>
